package com.tanhua.admin.task;

import cn.hutool.core.date.DateUtil;
import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class AnalysisTask {

    @Autowired
    private AnalysisService analysisService;

    @Scheduled(cron = "0/5 * * * * *")
    //@Scheduled(cron = "0 0 * * * *")
    public void task() {
        System.out.println("统计分析执行开始:" + DateUtil.format(new Date(), "HH:mm:ss:SSS"));

        //数据统计分析
        analysisService.analysis();

        System.out.println("统计分析执行完成:" + DateUtil.format(new Date(), "HH:mm:ss:SSS"));
    }
}
